﻿<div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">
 
    <script type='text/html' template> 
        <input type='hidden' name='PID' value="{{ d.params.PID || '' }}"/>
    </script>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>售后单号</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='OrderNumber' value='{{ d.params.OrderNumber || '' }}' lay-verify='required' placeholder='售后单号' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>    
    <div class='layui-form-item'>
        <label class='layui-form-label'>商品订单 </label>
        <div class='layui-input-block'>
            <div class='layui-input-inline'>
                <script type='text/html' template lay-done='layui.data.getSelSource(d.params,"OrderPID_SelSource");'>
                    <select name='OrderPID_SelSource' id='OrderPID_SelSource' lay-search></select>
                </script>
            </div>
        </div>
    </div>    
    <div class='layui-form-item'>
        <label class='layui-form-label'>订单商品 </label>
        <div class='layui-input-block'>
            <div class='layui-input-inline'>
                <script type='text/html' template lay-done='layui.data.getSelSource(d.params,"OrderGoodsPID_SelSource");'>
                    <select name='OrderGoodsPID_SelSource' id='OrderGoodsPID_SelSource' lay-search></select>
                </script>
            </div>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>品牌</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='Brand' value='{{ d.params.Brand || '' }}' lay-verify='required' placeholder='品牌' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>商品名称</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='Name' value='{{ d.params.Name || '' }}' lay-verify='required' placeholder='商品名称' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div> 
    <div class='layui-form-item'>
        <label class='layui-form-label'>商品图片</label>
        <div class='layui-input-inline'>
            <script type='text/html' template lay-done='layui.data.setUpload(d);'>
                <input type='text' name='Path_Upload' id='Path_Upload' value='{{ d.params.Path_Upload || '' }}' lay-verify='required' placeholder='请上传图片' autocomplete='off' class='layui-input'>
            </script>
        </div>
        <div class='layui-input-inline layui-btn-container' style='width: auto;'>
            <button type='button' class='layui-btn layui-btn-primary' id='Path_UploadBtn'>
                <i class='layui-icon'>&#xe67c;</i>上传图片
            </button>
            <button class='layui-btn layui-btn-primary' layadmin-event='Path_UploadImg'>查看图片</button>
        </div>
    </div>
    
    <div class='layui-form-item'>
        <label class='layui-form-label'>规格ID </label>
        <div class='layui-input-block'>
            <div class='layui-input-inline'>
                <script type='text/html' template lay-done='layui.data.getSelSource(d.params,"Specifications_SelSource");'>
                    <select name='Specifications_SelSource' id='Specifications_SelSource' lay-search></select>
                </script>
            </div>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>规格名称</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='Specifications' value='{{ d.params.Specifications || '' }}' lay-verify='required' placeholder='规格名称' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>商品支付单价</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='Price' value='{{ d.params.Price || '' }}' lay-verify='required' placeholder='商品支付单价' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>商品购买数量</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='Count' value='{{ d.params.Count || '' }}' lay-verify='required|number' placeholder='商品购买数量' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>商品支付总价</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='AllPrice' value='{{ d.params.AllPrice || '' }}' lay-verify='required' placeholder='商品支付总价' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>     
    <div class='layui-form-item'>
        <label class='layui-form-label'>退换货类型 </label>
        <div class='layui-input-block'>
            <div class='layui-input-inline'>
                <script type='text/html' template>
                    <select name='Type_Sel'>                      <option value='0' {{ d.params.Type_Sel == '0' ? 'selected' : '' }}>退货</option>                      <option value='1' {{ d.params.Type_Sel == '1' ? 'selected' : '' }}>换货</option>                      <option value='2' {{ d.params.Type_Sel == '2' ? 'selected' : '' }}>维修</option>                      <option value='3' {{ d.params.Type_Sel == '3' ? 'selected' : '' }}>退款</option>
                    </select>
                </script> 
            </div>
        </div>
    </div>
         
    <div class='layui-form-item'>
        <label class='layui-form-label'>换取方式 </label>
        <div class='layui-input-block'>
            <div class='layui-input-inline'>
                <script type='text/html' template>
                    <select name='AccessMode_Sel'>                      <option value='0' {{ d.params.AccessMode_Sel == '0' ? 'selected' : '' }}>上门取件</option>                      <option value='1' {{ d.params.AccessMode_Sel == '1' ? 'selected' : '' }}>快递寄回</option>                      <option value='2' {{ d.params.AccessMode_Sel == '2' ? 'selected' : '' }}>送回店铺</option>
                    </select>
                </script> 
            </div>
        </div>
    </div>
       
    <div class='layui-form-item'>
        <label class='layui-form-label'>联系人</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='UserName' value='{{ d.params.UserName || '' }}' lay-verify='required' placeholder='联系人' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>联系单位</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='UserCompany' value='{{ d.params.UserCompany || '' }}' lay-verify='required' placeholder='联系单位' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>联系电话</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='UserTel' value='{{ d.params.UserTel || '' }}' lay-verify='required' placeholder='联系电话' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>联系地址</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='UserAddress' value='{{ d.params.UserAddress || '' }}' lay-verify='required' placeholder='联系地址' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>上门时间</label>
        <div class='layui-input-inline'>
            <script type='text/html' template  lay-done='layui.data.datedone(d.params);'>
                <input type='text' name='PickTime' readonly='readonly' id='PickTime' value='{{ d.params.PickTime || '' }}' lay-verify='datetime' placeholder='yyyy-MM-dd HH:mm:ss' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>
        
    <div class='layui-form-item'>
        <label class='layui-form-label'>更换规格ID </label>
        <div class='layui-input-block'>
            <div class='layui-input-inline'>
                <script type='text/html' template lay-done='layui.data.getSelSource(d.params,"SpecificationsChange_SelSource");'>
                    <select name='SpecificationsChange_SelSource' id='SpecificationsChange_SelSource' lay-search></select>
                </script>
            </div>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>更换规格名称</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='SpecificationsChange' value='{{ d.params.SpecificationsChange || '' }}' lay-verify='required' placeholder='更换规格名称' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>退款金额</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='ReturnPrice' value='{{ d.params.ReturnPrice || '' }}' lay-verify='required' placeholder='退款金额' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>退换数量</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='SaleCount' value='{{ d.params.SaleCount || '' }}' lay-verify='required|number' placeholder='退换数量' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>售后原因</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='ReasonContent' value='{{ d.params.ReasonContent || '' }}' lay-verify='required' placeholder='售后原因' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>售后说明</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='Note' value='{{ d.params.Note || '' }}' lay-verify='required' placeholder='售后说明' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div> 
    <div class='layui-form-item'>
        <label class='layui-form-label'>图片描述</label>
        <div class='layui-input-inline'>
            <script type='text/html' template lay-done='layui.data.setUpload(d);'>
                <input type='text' name='Img_Upload' id='Img_Upload' value='{{ d.params.Img_Upload || '' }}' lay-verify='required' placeholder='请上传图片' autocomplete='off' class='layui-input'>
            </script>
        </div>
        <div class='layui-input-inline layui-btn-container' style='width: auto;'>
            <button type='button' class='layui-btn layui-btn-primary' id='Img_UploadBtn'>
                <i class='layui-icon'>&#xe67c;</i>上传图片
            </button>
            <button class='layui-btn layui-btn-primary' layadmin-event='Img_UploadImg'>查看图片</button>
        </div>
    </div>
   
    <div class='layui-form-item'>
        <label class='layui-form-label'>备注</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='Remark' value='{{ d.params.Remark || '' }}' lay-verify='required' placeholder='备注' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>     
    <div class='layui-form-item'>
        <label class='layui-form-label'>处理状态 </label>
        <div class='layui-input-block'>
            <div class='layui-input-inline'>
                <script type='text/html' template>
                    <select name='State_Sel'>                      <option value='0' {{ d.params.State_Sel == '0' ? 'selected' : '' }}>申请中</option>                      <option value='1' {{ d.params.State_Sel == '1' ? 'selected' : '' }}>处理中</option>                      <option value='2' {{ d.params.State_Sel == '2' ? 'selected' : '' }}>已完成</option>                      <option value='3' {{ d.params.State_Sel == '3' ? 'selected' : '' }}>不予处理</option>                      <option value='4' {{ d.params.State_Sel == '4' ? 'selected' : '' }}>取消</option>                      <option value='5' {{ d.params.State_Sel == '5' ? 'selected' : '' }}>已评价</option>
                    </select>
                </script> 
            </div>
        </div>
    </div>
        
    <div class='layui-form-item'>
        <label class='layui-form-label'>受理人 </label>
        <div class='layui-input-block'>
            <div class='layui-input-inline'>
                <script type='text/html' template lay-done='layui.data.getSelSource(d.params,"AcceptUser_SelSource");'>
                    <select name='AcceptUser_SelSource' id='AcceptUser_SelSource' lay-search></select>
                </script>
            </div>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>受理时间</label>
        <div class='layui-input-inline'>
            <script type='text/html' template  lay-done='layui.data.datedone(d.params);'>
                <input type='text' name='AcceptTime' readonly='readonly' id='AcceptTime' value='{{ d.params.AcceptTime || '' }}' lay-verify='datetime' placeholder='yyyy-MM-dd HH:mm:ss' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>
       
    <div class='layui-form-item'>
        <label class='layui-form-label'>处理结果说明</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='AcceptNote' value='{{ d.params.AcceptNote || '' }}' lay-verify='required' placeholder='处理结果说明' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>店铺ID</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='StoreID' value='{{ d.params.StoreID || '' }}' lay-verify='required' placeholder='店铺ID' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div>   
    <div class='layui-form-item'>
        <label class='layui-form-label'>新回复标记 1</label>
        <div class='layui-input-inline'>
            <script type='text/html' template>
                <input type='text' name='NewReplyFlag' value='{{ d.params.NewReplyFlag || '' }}' lay-verify='required' placeholder='新回复标记 1' autocomplete='off' class='layui-input'>
            </script>
        </div>
    </div> 
    <div class="layui-form-item">
        <label class="layui-form-label"></label>
        <div class="layui-input-inline">
            <input type="button" lay-submit lay-filter="layuiadmin-app-form-submit" value="确认" class="layui-btn">
        </div>
    </div>
</div>

<script type="text/javascript"> 
    layui.use(['form','admin','upload','laydate'], function () {
        var form = layui.form;//required（必填项）phone（手机号）email（邮箱）url（网址）number（数字）date（日期）identity（身份证） 自定义值
    });
    
    layui.data.getSelSource = function (d,sourceName) { 
         layui.use(['admin','form'], function () {
                var $ = layui.$;
                var form = layui.form;
                var admin = layui.admin;
    
            if (sourceName == "OrderPID_SelSource") {
                admin.req({
                    url: layui.setter.APIUrl + '/shop/orderMgr/customerQuery', //实际使用请改成服务端真实接口
                    type: 'post',
                    done: function (res) {
                        //$("#OrderPID_SelSource").append("<option value=''>全部</option>");
                        layui.each(res.Data, function (index, eachdata) {
                            var strIsSel = '';
                            if (eachdata.PID == d.OrderPID_SelSource)
                                strIsSel = "selected='selected'";
                            $("#OrderPID_SelSource").append("<option value='" + eachdata.PID + "' " + strIsSel + ">" + eachdata.OrderNumber + "</option>");
                        });
                        form.render('select');
                    }
                }); 
            }
            if (sourceName == "OrderGoodsPID_SelSource") {
                admin.req({
                    url: layui.setter.APIUrl + '/shop/order_goodsMgr/customerQuery', //实际使用请改成服务端真实接口
                    type: 'post',
                    done: function (res) {
                        //$("#OrderGoodsPID_SelSource").append("<option value=''>全部</option>");
                        layui.each(res.Data, function (index, eachdata) {
                            var strIsSel = '';
                            if (eachdata.PID == d.OrderGoodsPID_SelSource)
                                strIsSel = "selected='selected'";
                            $("#OrderGoodsPID_SelSource").append("<option value='" + eachdata.PID + "' " + strIsSel + ">" + eachdata.Name + "</option>");
                        });
                        form.render('select');
                    }
                }); 
            }
            if (sourceName == "Specifications_SelSource") {
                admin.req({
                    url: layui.setter.APIUrl + '/shop/goods_specificationsMgr/customerQuery', //实际使用请改成服务端真实接口
                    type: 'post',
                    done: function (res) {
                        //$("#Specifications_SelSource").append("<option value=''>全部</option>");
                        layui.each(res.Data, function (index, eachdata) {
                            var strIsSel = '';
                            if (eachdata.PID == d.Specifications_SelSource)
                                strIsSel = "selected='selected'";
                            $("#Specifications_SelSource").append("<option value='" + eachdata.PID + "' " + strIsSel + ">" + eachdata.Name + "</option>");
                        });
                        form.render('select');
                    }
                }); 
            }
            if (sourceName == "SpecificationsChange_SelSource") {
                admin.req({
                    url: layui.setter.APIUrl + '/shop/goods_specificationsMgr/customerQuery', //实际使用请改成服务端真实接口
                    type: 'post',
                    done: function (res) {
                        //$("#SpecificationsChange_SelSource").append("<option value=''>全部</option>");
                        layui.each(res.Data, function (index, eachdata) {
                            var strIsSel = '';
                            if (eachdata.PID == d.SpecificationsChange_SelSource)
                                strIsSel = "selected='selected'";
                            $("#SpecificationsChange_SelSource").append("<option value='" + eachdata.PID + "' " + strIsSel + ">" + eachdata.Name + "</option>");
                        });
                        form.render('select');
                    }
                }); 
            }
            if (sourceName == "AcceptUser_SelSource") {
                admin.req({
                    url: layui.setter.APIUrl + '/admin/userMgr/customerQuery', //实际使用请改成服务端真实接口
                    type: 'post',
                    done: function (res) {
                        //$("#AcceptUser_SelSource").append("<option value=''>全部</option>");
                        layui.each(res.Data, function (index, eachdata) {
                            var strIsSel = '';
                            if (eachdata.PID == d.AcceptUser_SelSource)
                                strIsSel = "selected='selected'";
                            $("#AcceptUser_SelSource").append("<option value='" + eachdata.PID + "' " + strIsSel + ">" + eachdata.UserName + "</option>");
                        });
                        form.render('select');
                    }
                }); 
            } 
        });
    }
 
     
    layui.data.setUpload = function (d) { 
        layui.use(['upload','admin'], function () {
                var $ = layui.$,
                upload = layui.upload,
                admin = layui.admin;
                var formSelects = layui.formSelects;
    
            //上传头像
            var Path_UploadSrc = $('#Path_Upload');
            upload.render({
                url: '/WebAPI/file/uploadImg/'
              , elem: '#Path_UploadBtn'
              , accept: 'images'
              , method: 'get'
              , multiple: true
              , acceptMime: 'image/*'
              , done: function (res) {
                  if (res.ResultCode == 0) {
                      Path_UploadSrc.val(res.Data.src);
                      layer.msg('上传成功');
                  } else {
                      layer.msg(res.msg);
                  }
              }
            });

            //查看图片
            admin.events.Path_UploadImg = function (othis) {
                var src = Path_UploadSrc.val();
                layer.photos({
                    photos: {
                        "title": "查看头像", //相册标题 
                       "data": [{
                       "src": src //原图地址
                      }]
                    }
                  , shade: 0.01
                  , closeBtn: 1
                  , anim: 5
                });
            };

            //上传头像
            var Img_UploadSrc = $('#Img_Upload');
            upload.render({
                url: '/WebAPI/file/uploadImg/'
              , elem: '#Img_UploadBtn'
              , accept: 'images'
              , method: 'get'
              , multiple: true
              , acceptMime: 'image/*'
              , done: function (res) {
                  if (res.ResultCode == 0) {
                      Img_UploadSrc.val(res.Data.src);
                      layer.msg('上传成功');
                  } else {
                      layer.msg(res.msg);
                  }
              }
            });

            //查看图片
            admin.events.Img_UploadImg = function (othis) {
                var src = Img_UploadSrc.val();
                layer.photos({
                    photos: {
                        "title": "查看头像", //相册标题 
                       "data": [{
                       "src": src //原图地址
                      }]
                    }
                  , shade: 0.01
                  , closeBtn: 1
                  , anim: 5
                });
            };
  
        });
    }

    
    layui.data.datedone = function (d) { 
        layui.use(['laydate'], function () {
                var laydate = layui.laydate;
    
            //日期时间选择器
            laydate.render({
                elem: '#PickTime'
              , type: 'datetime'
              , calendar: true
            });
            laydate.val = d.PickTime;

            //日期时间选择器
            laydate.render({
                elem: '#AcceptTime'
              , type: 'datetime'
              , calendar: true
            });
            laydate.val = d.AcceptTime;
 
        });
    }   
</script>
